package com.cjxt.ams.domain;

import com.cjxt.ams.utils.Result;
import lombok.Data;

/**
 * @author fangzhiyu
 * @version V1.0
 * @Description:
 * @className: Result
 * @date 2021/12/2 14:51
 * @company:华勤技术股份有限公司
 * @copyright: Copyright (c) 2021
 */

@Data
public class ResultVo<T> {

    private int code=0;

    private String message="操作成功";

    //private Integer count = 1000;

    private T data;



    public static ResultVo ok(String message){
        ResultVo result =new ResultVo();
        result.setMessage(message);
        return result;
    }

    public static ResultVo ok(){
        return new ResultVo();
    }

    public static ResultVo ok(Object objs){
        ResultVo result =new ResultVo();
        result.setData(objs);
        return result;
    }

    public static ResultVo error(int code){
        ResultVo result =new ResultVo();
        result.setMessage("操作失败");
        result.setCode(code);
        return result;
    }

    public static ResultVo error(String message){
        ResultVo result =new ResultVo();
        result.setMessage(message);
        result.setCode(500);
        return result;
    }

    /**
     * 认证失败
     * @param message
     * @return
     */
    public static ResultVo noAuth(String message){
        ResultVo result =new ResultVo();
        result.setMessage(message);
        result.setCode(510);
        return result;
    }
}
